home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / VIC20 / E-Education / (v)e3.d64 / vic pilot 3k.v (.txt) < prev    next >
Commodore BASIC  |  2007-02-17  |  3KB  |  113 lines

  1. 1 GOTO10:REM **PILOT**
  2. 2 I$=""
  3. 3 SYS820:IFPEEK(0)=13THENRETURN
  4. 4 I$=I$+CHR$(PEEK(0)):GOTO3
  5. 10 CLR:M=200:X=0:Y=0:A=0:P=0:Z=0:I$="":DIMS%(9),N%(26),S$(26),L$(M),C$(15):F%=0
  6. 20 PRINT"[147] **** PILOT V2.1 ****":FORX=820TO825:READZ:POKEX,Z:NEXT:FORX=0TO15
  7. 25 READC$(X):NEXT:DATA32,207,255,133,0,96
  8. 30 DATALIST,RUN,SAVE,LOAD,NEW,BASIC,PLIST,T,J,E,U,M,C,A,I,H
  9. 40 PRINT"PILOT."
  10. 50 GOSUB2:PRINT:IFASC(I$)=32ANDLEN(I$)=1THEN50
  11. 60 IFLEFT$(I$,1)=" "THENI$=MID$(I$,2):GOTO60
  12. 70 L=VAL(I$):IFL<>0THEN200
  13. 80 L=1:H=M:R$="":FORX=1TOLEN(I$):IFMID$(I$,X,1)<>" "THENNEXTX:GOTO140
  14. 90 R$=MID$(I$,X+1):I$=LEFT$(I$,X-1)
  15. 100 L=VAL(R$):H=L:FORX=1TOLEN(R$):IFMID$(R$,X,1)<>"-"THENNEXT:GOTO120
  16. 110 L=VAL(LEFT$(R$,X-1)):H=VAL(MID$(R$,X+1))
  17. 120 IFL=0THENL=1
  18. 130 IFH=0THENH=M
  19. 140 FORX=0TO6:IFI$<>LEFT$(C$(X),LEN(I$))THENNEXT:PRINT"UNKNOWN COMMAND":GOTO40
  20. 150 ONX+1GOTO400,1000,500,600,700,800,390
  21. 200 IFL>MTHENPRINT"LINE NUMBER OUT OF RANGE":GOTO40
  22. 210 X=LEN(STR$(L)):X$=MID$(I$,X):IFX$=""THENL$(L)="":GOTO50
  23. 220 IFLEFT$(X$,1)=" "THENX$=MID$(X$,2):GOTO220
  24. 230 X=3:IFMID$(X$,2,1)<>":"THENX=4:IFMID$(X$,3,1)<>":"THENL$(L)=X$:GOTO50
  25. 240 FORZ=7TO15:IFLEFT$(X$,1)<>C$(Z)THENNEXT:PRINT"ILLEGAL COMMAND":GOTO40
  26. 250 IFMID$(X$,2,1)="Y"THENZ=Z+10
  27. 260 IFMID$(X$,2,1)="N"THENZ=Z+20
  28. 270 L$(L)=CHR$(Z-6)+MID$(X$,X):GOTO50
  29. 390 OPEN1,4:GOTO410
  30. 400 OPEN1,3
  31. 410 FORX=LTOH:IFL$(X)=""THEN450
  32. 420 X$=":":Z=ASC(L$(X)):IFZ>30THENX$=LEFT$(L$(X),1):GOTO440
  33. 425 IFZ>20THENZ=Z-20:X$="N"+X$
  34. 430 IFZ>10THENZ=Z-10:X$="Y"+X$
  35. 435 X$=C$(Z+6)+X$
  36. 440 PRINT#1,X;X$;MID$(L$(X),2)
  37. 450 GETX$:IFX$<>""THENCLOSE1:GOTO40
  38. 460 NEXT:CLOSE1:GOTO40
  39. 500 OPEN1,8,2,R$+",S,W":PRINT"SAVING "R$
  40. 510 FORX=1TOM:IFL$(X)=""THEN530
  41. 520 PRINT#1,X;CHR$(13)CHR$(34)L$(X)CHR$(34)CHR$(13);
  42. 530 NEXTX:CLOSE1:GOTO40
  43. 600 OPEN1,8,2,R$+",S,R":PRINT"LOADING "R$
  44. 610 INPUT#1,X:IFSTGOTO630
  45. 620 INPUT#1,L$(X):IFST=0THEN610
  46. 630 CLOSE1:GOTO40
  47. 700 GOTO10
  48. 800 PRINT"EXITING TO BASIC":END
  49. 1000 L=0:FORX=1TO25:N%(X)=0:S$(X)="":NEXT:P=0:F%=0
  50. 1010 L=L+1:IFL>=MORL$(L)="END"THEN40
  51. 1011 GETX$:IFX$="@"THEN40
  52. 1015 IFL$(L)=""THEN1010
  53. 1020 X=ASC(L$(L)):IFX>40THEN1010
  54. 1030 IFX>20THENX=X-20:IFF%=1THEN1010
  55. 1040 IFX>10THENX=X-10:IFF%=0THEN1010
  56. 1050 C$=MID$(L$(L),2):ONXGOTO1100,1220,1300,1200,1500,1600,1700,1800,1900
  57. 1090 PRINT"ERROR #"E"IN LINE"L:GOTO40
  58. 1100 Z=0:IFRIGHT$(C$,1)=";"THENZ=1:C$=LEFT$(C$,LEN(C$)-1)
  59. 1105 FORX=1TOLEN(C$):X$=MID$(C$,X,1):IFX$="#"THEN1150
  60. 1110 IFX$="$"THEN1160
  61. 1120 PRINTX$;:NEXT:IFZ=0THENPRINT
  62. 1130 GOTO1010
  63. 1150 GOSUB1190:X$=STR$(N%(Y)):GOTO1120
  64. 1160 GOSUB1190:X$=S$(Y):GOTO1120
  65. 1190 X=X+1:Y=ASC(MID$(C$,X,1))-64:IFY<1ORY>26THENE=1:GOTO1090
  66. 1195 RETURN
  67. 1200 IFP>8THENE=3:GOTO1090
  68. 1210 P=P+1:S%(P)=L
  69. 1220 IFVAL(C$)<>0THENL=VAL(C$)-1:GOTO1010
  70. 1230 FORX=1TOM:IFC$<>L$(X)THENNEXT:E=2:GOTO1090
  71. 1240 L=X:GOTO1010
  72. 1300 IFP=0THENE=4:GOTO1090
  73. 1310 L=S%(P):P=P-1:GOTO1010
  74. 1500 X=1:C$=C$+",":X$=AC$:IFLEFT$(C$,1)="$"THENGOSUB1590
  75. 1510 FORZ=XTOLEN(C$):IFMID$(C$,Z,1)<>","THENNEXT
  76. 1520 Z$=MID$(C$,X,Z-X):FORY=1TOLEN(X$):IFMID$(X$,Y,LEN(Z$))=Z$THENF%=1:GOTO1010
  77. 1560 NEXT:IFZ<LEN(C$)THENX=Z+1:GOTO1510
  78. 1570 F%=0:GOTO1010
  79. 1590 Y=ASC(MID$(C$,2))-64:IFY<1ORY>26THENE=1:GOTO1090
  80. 1595 X$=S$(Y):X=4:RETURN
  81. 1600 A=3:Z=0:X$="":IFLEFT$(C$,1)<>"#"ORMID$(C$,3,1)<>"="THENE=5:GOTO1090
  82. 1610 Y=1:X$=MID$(C$,A,1):A=A+1:IFMID$(C$,A,1)="-"THENA=A+1:Y=-1
  83. 1620 IFMID$(C$,A,1)<>"#"THENY=Y*VAL(MID$(C$,A)):A=A+LEN(STR$(Y))-1:GOTO1650
  84. 1630 X=ASC(MID$(C$,A+1))-64:IFX<1ORX>26THENE=1:GOTO1090
  85. 1635 IFX=18THENY=Y*RND(1):GOTO1650
  86. 1640 Y=Y*N%(X):A=A+2
  87. 1650 IFX$="="THENZ=Y
  88. 1655 IFX$="-"THENZ=Z-Y
  89. 1660 IFX$="+"THENZ=Z+Y
  90. 1665 IFX$="/"ANDY=0THENE=6:GOTO1090
  91. 1670 IFX$="*"THENZ=Z*Y
  92. 1675 IFX$="/"THENZ=Z/Y
  93. 1680 IFA<=LEN(C$)THEN1610
  94. 1685 Y=N%(X1):IFX-4>0THENIFMID$(C$,X-4)="-"ANDX-4<>ATHENZ=-Z
  95. 1690 X=ASC(MID$(C$,2))-64:IFX<1ORX>26THENE=1:GOTO1090
  96. 1692 IFZ>32767ORZ<-32767THENE=7:GOTO1090
  97. 1695 N%(X)=Z:GOTO1010
  98. 1700 IFC$=""THENGOSUB2:AC$=I$:PRINT:GOTO1010
  99. 1720 X=ASC(MID$(C$,2))-64:IFX<1ORX>26THENE=1:GOTO1090
  100. 1730 GOSUB2:Z=VAL(I$):PRINT:IFLEFT$(C$,1)="#"THENN%(X)=Z
  101. 1740 IFLEFT$(C$,1)="$"THENS$(X)=I$
  102. 1750 GOTO1010
  103. 1800 IFLEFT$(C$,1)<>"#"THENE=5:GOTO1090
  104. 1810 X=ASC(MID$(C$,2))-64:IFX<1ORX>26THENE=1:GOTO1090
  105. 1820 A=N%(X):X$=MID$(C$,3,1):IFMID$(C$,4,1)<>"#"THENX=VAL(MID$(C$,4)):GOTO1840
  106. 1830 X=ASC(MID$(C$,5))-64:IFX<1ORX>26THENE=1:GOTO1090
  107. 1835 X=N%(X)
  108. 1840 F%=0:IFX$="<"ANDA<XTHENF%=1
  109. 1850 IFX$=">"ANDA>XTHENF%=1
  110. 1860 IFX$="="ANDA=XTHENF%=1
  111. 1870 GOTO1010
  112. 1900 PRINT"[147]";:GOTO1010
  113.